package com.atguigu.gulimall.gulimallmember.controller;

import com.atguigu.common.utils.R;
import com.atguigu.gulimall.gulimallmember.entity.UmsMemberEntity;
import com.atguigu.gulimall.gulimallmember.feign.CouponFeignService;
import com.atguigu.gulimall.gulimallmember.service.UmsMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName MemberController
 * @Description TODO
 * @Author 周轩霆
 * @Date 2023/1/9 15:30
 **/
@RestController
@RequestMapping("member/member")
public class MemberController {
    @Autowired
    private UmsMemberService memberService;

    @Autowired
    CouponFeignService couponFeignService;

    @RequestMapping("/coupons")
    public R test() {
        UmsMemberEntity memberEntity = new UmsMemberEntity();
        memberEntity.setNickname("张三");
        R membercoupons = couponFeignService.membercoupons(); //假设张三去数据库查了后返回了张三的优惠券信息

        // 打印会员和优惠券信息
        return R.ok().put("member", memberEntity).put("coupons", membercoupons.get("coupons"));
    }
}
